package com.edfu.core.coursemgt.persistence.entity;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@Entity
@Table(name="lessonunit", uniqueConstraints=@UniqueConstraint(columnNames={"name" , "lesson_id"}))
public class LessonUnitEntity implements ICourseMgtEntity {
	private long id;
	private String title;
	private String name;
	private String contentDirectory;
	private String description;
	private int unitNo;
	private LessonUnitEntity parentUnit;
	private LessonEntity lesson;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setTitle(String title) {
		this.title = title;
	} 
	public String getContentDirectory() {
		return contentDirectory;
	}
	public void setContentDirectory(String contentDirectory) {
		this.contentDirectory = contentDirectory;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public int getUnitNo() {
		return unitNo;
	}
	public void setUnitNo(int unitNo) {
		this.unitNo = unitNo;
	}
	
	@ManyToOne
	@JoinColumn(name = "parentunit_id", nullable = true)
	public LessonUnitEntity getParentUnit() {
		return parentUnit;
	}
	public void setParentUnit(LessonUnitEntity parentUnit) {
		this.parentUnit = parentUnit;
	}
	
	@ManyToOne
	@JoinColumn(name = "lesson_id", nullable = false)
	public LessonEntity getLesson() {
		return lesson;
	}
	public void setLesson(LessonEntity lesson) {
		this.lesson = lesson;
	}
	
}
